
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title></title>
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" type="text/css" href="css/reset.css">
    <link rel="stylesheet" type="text/css" href="css/layer.css">
    <link rel="stylesheet" type="text/css" href="css/swiper.min.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" type="text/css" href="css/index.css?1.1">
    <script src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery.cookie.js"></script>
    <script src="js/layer.js"></script>
    <script src="js/swiper.min.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
</head>
<body>
  <div class="nav"></div>
  <!-- 首页 -->
  <div class="index-box">
    <!-- 轮播图 -->
    <div class="banner">
        <div class="swiper-container">
          <div class="swiper-wrapper">
          </div>
          <div class="swiper-pagination"></div>
        </div>
    </div>
    <!-- 视频列表 -->
    <div class="list-box">
    </div>
  <div class="search-box searchide"></div>
  <script>
      $(function(){
          // 轮播图
          $.ajax({
              url: window.baseUrl+'api/index/index',
              type: 'get',
              contentType: false,
              processData: false,
              success: function (data) {
                  // banner图
                  var banner = data.datas.banner;
                  var bannerStr ="";
                  for(var i = 0;i<banner.length;i++){
                      var bannerStr = bannerStr+'<div class="swiper-slide">'+'<a href="detail.html?id='+banner[i].movieId+'" class="banner-img">'+'<img src="'+banner[i].image+'"></a><div class="banner-title">'+banner[i].title+'</div></div>';
                  }
                  $(".swiper-wrapper").append(bannerStr);
                  var mySwiper = new Swiper('.swiper-container', {
                      autoplay: 5000,//可选选项，自动滑动
                      pagination : '.swiper-pagination',
                  })
                  // 首页热门
                  var indexList = data.datas.indexCategory;
                  var listStr = '';
                  var movieList =''
                  for(var i = 0;i<indexList.length;i++){
                     listStr = "";
                     listStr = listStr +'<div class="list"><div class="list-type clearfix"><div class="list-title">'+indexList[i].name+'</div><a href="film_list.html" class="list-clone">更多电影 <span></span></a></div><ul></ul>';
                       $(".list-box").append(listStr)
                     for(var j = 0;j<indexList[i].movies.length;j++){
                          movieList =''
                          if(indexList[i].movies[j].tag == ''){
                              var setTag = ''
                          }else{
                              var setTag = '<div class="hot"><span>'+indexList[i].movies[j].tag+'</span></div>'
                          }
                          movieList = movieList+'<li><div class="piclist-img">'+
                            '<a href="detail.html?id='+indexList[i].movies[j].id+'" >'+
                            '<img src="'+indexList[i].movies[j].logo+'" alt="">'+
                            '<div class="definition">'+indexList[i].movies[j].clarity+'</div>'+setTag+
                            ' </a></div><div class="piclist-title">'+indexList[i].movies[j].movieName+'</div></li></div>';
                            $(".list-box .list").eq(i).find("ul").append(movieList)
                     }
                  }
              }
          });
      })
  </script>
</body>
</html>